<template>
	<view>

		<view class="post-content">
			<view class="title-area">
				{{info.title}}
			</view>

			{{info.content}}

			<view class="time-display">
				{{tools.formatDate(info.lastupdate)}}
			</view>

			<view class="time-display1">
				发布人：{{info.username}}
			</view>

		</view>

	</view>
</template>

<script setup>
	import {
		onLoad
	} from '@dcloudio/uni-app'

	onLoad((event) => {
		console.log('加载信息：', event)
		bid.value = event.bid
		query();
	})

	import {
		ref
	} from 'vue'
	import {
		api,
		tools
	} from '../../api/api.js'

	const bid = ref(-1)
	const info = ref(({}))

	const query = () => {
		api.get(`/crud/billboard/${bid.value}`, {}, (data) => {
			if (data.success) {
				info.value = data.data
				return
			}
			uni.showToast({
				title: data.message,
				complete: () => {
					uni.navigateTo({
						url: '/pages/notice/notice'
					})
				}
			})
		})
	}
</script>

<style>
	.post-content {
		font-family: 'Arial', sans-serif;

		font-size: 16px;

		line-height: 1.5;

		color: #333;

		margin: 20px;

		padding: 20px;

		background-color: #f9f9f9;

		border-radius: 8px;

		word-wrap: break-word;

		max-width: 800px;

		box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

	}

	.title-area {
		color: #2c3e50;

		margin-top: 20px;

		margin-bottom: 10px;

		font-size: 26px;

	}

	.time-display {
		position: fixed;
		bottom: 20px;
		right: 20px;
		font-size: 12px;
		color: #333;
		opacity: 0.7;
	}

	.time-display1 {
		position: fixed;
		bottom: 20px;
		left: 20px;
		font-size: 12px;
		color: #333;
		opacity: 0.7;
	}
</style>